/**
 * @author Lenovo
 * @date 2022/3/7
 */
//代表棋子的javaBean,保存棋子的基本信息
public  class ChessBean implements  Comparable<ChessBean> {
    //代表棋子的javaBean ,代表
    private int x;
    private int y;
    //1黑2白
    private int player;
    //保存棋子落子的顺序
    private int orderNum;
    private int offense;
    private int defense;
    private int sum;
    private StringBuffer buffer=new StringBuffer();
    public int getX() {
        return x;
    }
    public void setX( int x ) {
        this.x = x;
    }
    public ChessBean( int x, int y, int player, int orderNUm){
        this.x=x;
        this.y=y;
        this.player=player;
        this.orderNum=orderNUm;
    }

    public int getY(){
        return y;
    }
    public void setPlayer(int player ){
        this.player=player;
    }
    public int getPlayer(){
        return player;
    }
    public void setOrderNum(int orderNum){
        this.orderNum=orderNum;
    }
    public int getOrderNum(){
        return orderNum;
    }
    public boolean isEmpty(){
        // return orderNum==0;
        return this.player==GamePanel.EMPTY;
    }
    public int getDefense(){
        return defense;
    }
    public void setDefense(int defense){
        this.defense=defense;
    }
    public int getSum(){
        return sum;
    }
    public void setSum(int sum){
        this.sum=sum;
    }
    public int compareTo( ChessBean o ) {
        if(this.sum>o.sum) {return -1;}
        else if(this.sum<o.sum) {return 1;}
        return 0;
    }
    public String toString(){
        return "ChessBean[x="+x+",y="+y+",player="+player+",orderNum="+orderNum+",offense="+offense+",defense="+defense+",sum="+sum+"]";
    }
    public int getOffense(){return offense;}
    public void setOffense(int offense){this.offense=offense; }
    public void setBuffer(StringBuffer buffer){
        this.buffer=buffer;
    }
    public StringBuffer getBuffer(){
        return buffer;
    }
}

